package com.itheima.CSM_bacK.aabServices;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.CSM_bacK.aabServices.Serv.OrderServ;
import com.itheima.CSM_bacK.aacMapper.OrderMapper;
import com.itheima.common.entity.PageResult;
import com.itheima.common.entity.QueryPageBean;
import com.itheima.pojo.Entity.Order;
import com.itheima.pojo.DTO.DTOoSetUP;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderImpl implements OrderServ {
    @Autowired
    private OrderMapper orderMapper;


    @Override
    public PageResult findPage(QueryPageBean kk) {
        PageHelper.startPage(kk.getCurrentPage(), kk.getPageSize());
        Page<Order> pps = orderMapper.findPage(kk.getQueryString());
        return new PageResult(pps.getTotal(), pps.getResult());
    }


    @Override
    public void update(DTOoSetUP kk) {
        Order order = new Order();
        BeanUtils.copyProperties(kk, order);

        orderMapper.update(order);
        
    }
}

